import { checkoldpwdReq } from '@/api/account.api'
export const checkOld = (rule, value, callback) => {
    if (!value) {
        return callback(new Error('原密码不能为空'));
        // callback();

    }
    checkoldpwdReq(value).then(res => {
        if (res.data.code === 0) callback()
        else callback(new Error('旧密码错误！'))
    })

};




export const validatePass = function (rule, value, callback) {
    if (value === '') {
        callback(new Error('请输入密码'));
    } else {
        if (this.ruleForm.checkPass !== '') {
            this.$refs.ruleForm.validateField('checkPass');
        }
        callback();
    }
};


export const validatePass2 = function (rule, value, callback) {
    if (value === '') {
        callback(new Error('请再次输入密码'));
    } else if (value !== this.ruleForm.newPwd) {
        callback(new Error('两次输入密码不一致!'));
    } else {
        callback();
    }
};